home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / RMTP03.ARJ / WRITEDEF.PAS < prev    next >
Pascal/Delphi Source File  |  1992-02-25  |  1KB  |  50 lines

  1. Program WriteDef;
  2.  Uses Graph;
  3. Const
  4.  Hex : array[0..15] of char = ('0','1','2','3','4','5','6','7','8','9',
  5.                                 'A','B','C','D','E','F');
  6. Var
  7.  Gd    : Integer;
  8.  Gm    : Integer;
  9.  F     : Text;
  10.  I     : Word;
  11.  J     : Word;
  12.  Col   : Word;
  13.  X1,X2 : Word;
  14.  Y1,Y2 : Word;
  15. Begin
  16.  Gd:=EGA;
  17.  Gm:=EGAhi;
  18.  InitGraph(Gd,Gm,'');                      (* Set path where EGAVGA.BGI *)
  19.                                            (* is located                *)
  20.  
  21.  SetFillStyle(SolidFill,Blue);
  22.  Bar(0,0,639,349);
  23.  
  24.  SetFillStyle(HatchFill,Green);
  25.  Bar(0,0,30,30);
  26.  SetFillStyle(SolidFill,LightRed);
  27.  Bar(20,20,40,40);                         (* Draw something            *)
  28.  
  29.  X1:=0;
  30.  Y1:=0;
  31.  X2:=40;                                   (* Dimensions of image       *)
  32.  Y2:=40;
  33.  
  34.  Assign(F,'BOX2.DEF');
  35.  Rewrite(F);
  36.  For J:=Y1 to Y2 do
  37.  Begin
  38.   For I:=X1 to X2 do
  39.   begin
  40.     Col:=GetPixel(I,J);
  41.     Write(F,Hex[Col]);
  42.   End;                                     (* Save image                *)
  43.   Writeln(F);
  44.  End;
  45.  Close(F);
  46.  
  47.  ReadLn;                                   (* Wait for enter key        *)
  48.  
  49.  CloseGraph;                               (* Close graphics            *)
  50. End.